package org.omg.PortableServer;

//
// Helper class for : POA
//
// @author OpenORB Compiler
//
public class POAHelper
{
	//
	// Insert POA into an any
	// @param	a an any
	// @param	t POA value
	//
	public static void insert( org.omg.CORBA.Any a, org.omg.PortableServer.POA t )
	{
		a.insert_Object( t , type() );
	}

	//
	// Extract POA from an any
	// @param	a an any
	// @return the extracted POA value
	//
	public static org.omg.PortableServer.POA extract( org.omg.CORBA.Any a )
	{
		if ( !a.type().equal( type() ) )
			throw new org.omg.CORBA.MARSHAL();
		try {
			return org.omg.PortableServer.POAHelper.narrow( a.extract_Object() );
		}
		catch ( org.omg.CORBA.BAD_PARAM ex ) {
			throw new org.omg.CORBA.MARSHAL();
		}
	}

	//
	// Internal TypeCode value
	//
	private static org.omg.CORBA.TypeCode _tc = null;

	//
	// Return the POA TypeCode
	// @return a TypeCode
	//
	public static org.omg.CORBA.TypeCode type()
	{
		if ( _tc == null ) {
			org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init();
			_tc = orb.create_interface_tc(id(),"POA");
		}
		return _tc;
	}

	//
	// Return the POA IDL ID
	// @return an ID
	//
	public static String id()
	{
		return _id;
	}

	private final static String _id = "IDL:omg.org/PortableServer/POA:1.0";

	//
	// Read POA from a marshalled stream
	// @param	istream the input stream
	// @return the readed POA value
	//
	public static org.omg.PortableServer.POA read( org.omg.CORBA.portable.InputStream istream )
	{
		throw new org.omg.CORBA.MARSHAL();
	}

	//
	// Write POA into a marshalled stream
	// @param	ostream the output stream
	// @param	value POA value
	//
	public static void write( org.omg.CORBA.portable.OutputStream ostream, org.omg.PortableServer.POA value )
	{
		throw new org.omg.CORBA.MARSHAL();
	}

	//
	// Narrow CORBA::Object to POA
	// @param	obj the CORBA Object
	// @return POA Object
	//
	public static POA narrow( org.omg.CORBA.Object obj )
	{
		if ( obj == null )
			return null;
		if ( obj instanceof POA )
			return ( POA)obj;

		throw new org.omg.CORBA.BAD_PARAM();
	}

	//
	// Unchecked Narrow CORBA::Object to POA
	// @param	obj the CORBA Object
	// @return POA Object
	//
	public static POA unchecked_narrow( org.omg.CORBA.Object obj )
	{
		if ( obj == null )
			return null;
		if ( obj instanceof POA )
			return ( POA)obj;

		throw new org.omg.CORBA.BAD_PARAM();
	}

}
